package text;

public class Demo_A {

    public static void main(String[] args) {
        int c = 0;
        try {
            String s = null;
            c = Integer.valueOf(s);
        }catch (Exception e){
            System.out.println("======异常捕获=======");
            e.printStackTrace();
            if (e instanceof NumberFormatException){
                c=1;
            }
        }
        System.out.println(c);//输出结果是1
       /* Random random = new Random();
        System.out.println(random.nextInt());
        System.out.println(random.nextBoolean());
        System.out.println(random.nextDouble());
        System.out.println(random.nextFloat());
        //当前时间戳作为ramdom的种子
        Random randomNow = new Random(System.currentTimeMillis());
        System.out.println(System.currentTimeMillis());
        //用BigDecimal类型代替浮点数计算
        System.out.println("==================");
        BigDecimal f1 = new BigDecimal("0.05");
        BigDecimal f2 = BigDecimal.valueOf(0.01);
        System.out.println(f1.add(f2));
        System.out.println(f1.subtract(f2));
        System.out.println(f1.multiply(f2));
        System.out.println(f1.divide(f2));*/

    }
}
